package cn.juque.systemservice.api.constant;

/**
 * @author nuoka
 */
public enum LifeCycleEnum {
    /**
     * 永久默认3个月
     */
    FOREVER(0, 7776000),
    ONE_DAY(1, 86400),
    DEFAULT(-999, 86400),
    ;

    /**
     * 值
     */
    private Integer value;
    /**
     * 描述
     */
    private Integer seconds;

    LifeCycleEnum(Integer value, Integer seconds) {
        this.value = value;
        this.seconds = seconds;
    }

    public Integer getValue() {
        return value;
    }

    public Integer getSeconds() {
        return seconds;
    }

    public static Integer getSeconds(Integer value) {
        for (LifeCycleEnum cycle : LifeCycleEnum.values()) {
            if (value.equals(cycle.getValue())) {
                return cycle.seconds;
            }
        }
        return DEFAULT.seconds;
    }
}
